package com.more.offer.threadtest.castest;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author pinoc
 * @date 2021/6/20
 * @description
 */
public class AtomicTest {
	private static AtomicInteger index = new AtomicInteger(10);

	public static void main(String[] args) {

		//A -B -A 问题
		new Thread(() -> {
			index.compareAndSet(10,11);
			index.compareAndSet(11,10);
			System.out.println(Thread.currentThread().getName() + "10 -> 11 -> 10");
		}, "张三").start();


	}
}
